/*
 * @Author: your name
 * @Date: 2019-11-27 09:05:29
 * @LastEditTime: 2019-12-03 19:42:08
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \web\avue-cli\src\api\equipment\device\management.js
 */
import request from '@/router/axios';
import qs from 'qs';
/**
 * @description: get设备设置列表
 * @param {object}
 * @return:promise
 */
export const getEquipmentList = (data = {}) => request({
  url: '/equipment/v1/pageQuery',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 获取仓库列表
 * @param {object}
 * @return:promise
 */
export const getWarehouseList = (data = {}) => request({
  url: '/warehouse/v1/findAll',
  method: 'post',
  data: qs.stringify(data),
})
/**
 * @description: 获取实验室列表
 * @param {object}
 * @return:promise
 */
export const getLaboratoryList = (data = {}) => request({
  url: '/laboratory/v1/selectAlLaboratory',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 获取设备类型(不要用)
 * @param {object} 
 * @return:promise
 */
export const getEquipmentType = (data = {}) => request({
  url: '/equipmentType/v1/findAllType',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 添加设备
 * @param {object}
 * @return:promise
 */
export const addEquipment = (data = {}) => request({
  url: '/equipment/v1/insert',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 根据id删除设备
 * @param {object}
 * @return:promise
 */
export const deleteEquipment = (data = {}) => request({
  url: '/equipment/v1/getById',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 根据id修改设备
 * @param {object}
 * @return:promise
 */
export const updateEquipment = (data = {}) => request({
  url: '/equipment/v1/update',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 台账
 * @param {object} {id}
 * @return:promise
 */
export const ledger = (data = {}) => request({
  url: '/equipment/v1/ledger',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 启用按钮
 * @param {object} {id}
 * @return:promise
 */
export const upWalk = (data = {}) => request({
  url: '/equipment/v1/updateByOpen',
  method: 'post',
  data: qs.stringify(data),
})

/**
 * @description: 停用按钮
 * @param {object} {id}
 * @return:promise
 */
export const downBack = (data = {}) => request({
  url: '/equipment/v1/updateByStop',
  method: 'post',
  data: qs.stringify(data),
})
/**
 * @description: 维保申请
 * @param {object}
 * @return:promise
 */
export const addMaintenanceAppointment = (data = {}) => request({
  url: '/maintenanceApplication/v1/insert',
  method: 'post',
  data: (data),
})
/**
 * @description: 故障报停
 * @param {object}
 * @return:promise
 */
export const addTrouble = (data = {}) => request({
  url: '/trouble/v1/insert',
  method: 'post',
  data: qs.stringify(data),
})
/**
 * @description: 报废申请
 * @param {object}
 * @return:promise
 */
export const addScrapApplication = (data = {}) => request({
  url: '/scrapApplication/v1/insert',
  method: 'post',
  data: qs.stringify(data),
})

// 所有设备类别
export const getDevList = (data = {}) => request({
  url: '/equipmentType/v1/findAllType',
  method: 'post',
  data: data,
})

// 设备类别 新增
export const addDev = (data = {}) => request({
  url: '/equipmentType/v1/insert',
  method: 'post',
  data: data,
})

// 设备类别 删除
export const delDev = (data = {}) => request({
  url: '/equipmentType/v1/getById',
  method: 'post',
  data: qs.stringify(data),
})

// 设备类别 修改
export const editDev = (data = {}) => request({
  url: '/equipmentType/v1/update',
  method: 'post',
  data: qs.stringify(data),
})

 
//(智能插座数据展示)根据设备id查询
export const selectElectricNow = (data = {}) => request({
  url: '/dashboardData/v1/selectElectricNow',
  method: 'post',
  data: qs.stringify(data),
  
})


//数据
export const dateTypeSelectAll = (data = {}) => request({
  url: '/dateType/v1/selectAll',
  method: 'post',
  data: qs.stringify(data),
})

//导出数据
export const excelWrite = (data = {}) => request({
  url: '/excel/v1/excelWrite',
  method: 'get',
  data: qs.stringify(data),
  params:data,
  responseType:'arraybuffer'
})

//设备管理列表
export const selectElAllNo = (data = {}) => request({
  url: '/equipment/v1/selectElAllNo',
  method: 'post',
  data: qs.stringify(data),
  params:data
})
